import { defineStore } from 'pinia';

import { getDefaultPlatform } from '@/api';

interface State {
  platformCardTpye: string;
  [key: string]: any;
}

const usePlatformStore = defineStore('platform', {
  state: () => ({
    platformCardTpye: '',
    loading: false,
  }) as State,
  actions: {
    async fetchDefaultPlatform() {
      try {
        this.loading = true;
        const { data } = await getDefaultPlatform();
        this.platformCardTpye = data.data || data.msg;
      } catch (error) {
        //
      } finally {
        this.loading = false;
      }
    },
  },
});

export default usePlatformStore;
